home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1992 June: ROMin Holiday / ADC Developer CD (1992-06) (''ROMin Holiday'')_iso / Developer Connection - 06-1992.iso / Tools & Apps / Testing & Debugging / VUAssist 1.0d10 / C++ interface to VUAssist / UVUAssist.a next >
Encoding:
Text File  |  1991-09-10  |  3.3 KB  |  120 lines  |  [TEXT/MPS ]

  1. ;
  2. ;    File:        UVUAssist.a - MacApp 3.0b2PQR compatible version
  3. ;
  4. ;    Contains:    hook VU assistance proc for the mole to call (glue routine for Object Pascal
  5. ;                method MoleAssist)
  6. ;
  7. ;    Written by:    David Shayer
  8. ;
  9. ;    Copyright:    © 1991 by Apple Computer, Inc., all rights reserved.
  10. ;
  11. ;    Version: 1.0d10
  12. ;
  13. ;    Change History (most recent first):
  14. ;
  15. ;         9/10/91    JAS        indicate 3.0b2PQR compatibility, change version
  16. ;         8/21/91    JAS        change version
  17. ;         8/13/91    JAS        change ObjectIntf for TVUAssist to include
  18. ;                            fGridItemSupport data member         
  19. ;         8/13/91    JAS        set CASE to OBJ
  20. ;         8/13/91    JAS        include ObjectIntf for TEvtHandler
  21. ;
  22.  
  23.         CASE        OBJ
  24.         INCLUDE        'ObjMacros.a'
  25.         INCLUDE        'SysEqu.a'
  26.         BLANKS        ON
  27.  
  28. ;    Historical Note:  References to the "Mole" are equivalent to references to 
  29. ;    "Agent VU".  "Agent VU" was previously called the "Mole".
  30. ;
  31. ;    FUNCTION MoleHook (Select :integer; Input :Ptr; VAR OutputSize :integer;
  32. ;            Result :integer) :OSErr; C;
  33. ;
  34. ;    This is a glue routine.  It is called by the mole, with a C interface.
  35. ;    It calls TVUAssist.MoleAssist with a Pascal interface.  It passes the
  36. ;    same parameters on, it just glues the C and Pascal interfaces together.
  37. ;
  38. ;    stack frame on entry (after LINK):
  39. ;    +-------------------+
  40. ;    |        Result        |
  41. ;    +-------------------+ <-- 18(A6)
  42. ;    |    *OutputSize        |
  43. ;    +-------------------+ <-- 14(A6)
  44. ;    |        Output        |
  45. ;    +-------------------+ <-- 10(A6)
  46. ;    |        Input        |
  47. ;    +-------------------+ <-- C(A6)
  48. ;    |        Select        |
  49. ;    +-------------------+ <-- 8(A6)
  50. ;    |    Return Address    |
  51. ;    +-------------------+ <-- 4(A6)
  52. ;    |        Old A6        |
  53. ;    +-------------------+ <-- A6
  54. ;
  55. ;    stack for call to TVUAssist.MoleAssist (at MethCall):
  56. ;    +-------------------+
  57. ;    |    Return Value    |
  58. ;    +-------------------+
  59. ;    |        Select        |
  60. ;    +-------------------+
  61. ;    |        Input        |
  62. ;    +-------------------+
  63. ;    |    *OutputSize        |
  64. ;    +-------------------+
  65. ;    |        Result        |
  66. ;    +-------------------+
  67. ;    |    Object Handle    |
  68. ;    +-------------------+ <-- A7
  69. ;
  70. ;    TVUAssist.MoleAssist will remove all parameters, leaving the return value
  71. ;    on the top of the stack.
  72. ;    The mole expects the return value in D0.  The mole will remove the parameters
  73. ;    it originally placed on the stack.
  74. ;
  75.  
  76.         Seg         'Main'
  77.  
  78. ;    Abridged object definition for TEvtHandler
  79.     ObjectIntf    TEventHandler, TObject, \
  80.         (fIdleFreq,4),                \
  81.         (fLastIdle,4),                \
  82.         (fNextHandler,4)
  83.         
  84. ;    Abridged object definition for TVUASSIST
  85.     ObjectIntf    TVUASSIST, TEventHandler,    \
  86.         (FMOLEREFNUM,2),            \
  87.         (GRIDITEMSUPPORT,1),        \
  88.         METHODS,                    \
  89.         (IVUASSIST),                \
  90.         (OPENMOLEDRIVER),            \
  91.         (SUSPENDMOLE),                \
  92.         (RESUMEMOLE),                \
  93.         (SETDEBUGGERHOOK),            \
  94.         (MOLEASSIST)
  95.  
  96.  
  97. MoleHook PROC EXPORT
  98.         IMPORT        gVUAssist:DATA        ;global pointer to VUAssist
  99.         LINK        A6, #$0                ;set up stack frame
  100.         MOVE.L        A5, -(A7)            ;save a5
  101.         MOVE.L        CurrentA5, A5        ;get application's A5
  102.         CLR.W        -(A7)                ;make space for return result
  103.         MOVE.W        $A(A6), -(A7)        ;push Select (load lo word)
  104.         MOVE.L        $C(A6), -(A7)        ;push Input
  105.         MOVE.L        $10(A6), -(A7)        ;push Output
  106.         MOVE.L        $14(A6), -(A7)        ;push OutputSize
  107.         MOVE.W        $1A(A6), -(A7)        ;push Result (load lo word)
  108.         MOVE.L        gVUAssist(A5),-(A7)    ;push object handle, which will become "Self"
  109.         MethCall    MOLEASSIST,TVUASSIST;call TVUAssist.MoleAssist
  110.         MOVE.W        (A7)+, D0            ;pop return result
  111.         EXT.L        D0                    ;make return result a longword
  112.         MOVE.L        (A7)+, A5            ;restore A5
  113.         UNLK        A6                    ;tear down stack frame
  114.         RTS                                ;return
  115.         DC.B        'MOLEHOOK'            ;Macsbug name
  116.         ENDPROC
  117.         
  118.         
  119.         END
  120.